﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;
//using TrainingWorkshop.DAL;
using TrainingWorkshop.Models;
using TrainingWorkshop.DAL_EF;

namespace TrainingWorkshop.BLL
{
    public class CourseManager
    {
        EFFactory effactory = new EFFactory();
        public List<CourseShows> GetAllCourses()
        {
            ICourseRepository_EF IRep = effactory.CourseRepository();
            List<CourseShows> courselist = IRep.GetAllCourses();
            return courselist;
        }
        /// <summary>
        /// GetSelectedCourses
        /// </summary>
        /// <param name="name">CourseName</param>
        /// <param name="status">Status</param>
        /// <returns>List CourseShow</returns>
        public List<CourseShows> GetSelectedCourses(string name, bool status)
        {
            ICourseRepository_EF rep = effactory.CourseRepository();
            List<CourseShows> courselist = rep.GetAllSelectedCourses(name, status);
            return courselist;
        }
        /// <summary>
        /// GetAllTeachers from database
        /// </summary>
        /// <returns>List Teacher</returns>
        public List<Models.Teacher> GetAllTeachers()
        {
            ITeacherRepository_EF IRep = effactory.TeacherRepository();
            return IRep.GetAllTeachers();
        }
        /// <summary>
        /// GetAllLevels from database
        /// </summary>
        /// <returns>List Level</returns>
        public List<Models.Level> GetAllLevels()
        {
            ILevelRepository_EF rep = effactory.LevelRepository();
            return rep.GetAllLevels();
        }
       
        /// <summary>
        /// DeleteCourse by CourseId
        /// </summary>
        /// <param name="id">CourseId</param>
        public void DeleteCourse(string id)
        {
            ICourseRepository_EF rep = effactory.CourseRepository();
            rep.DeleteCourse(id);
        }
        /// <summary>
        /// Update Course 
        /// </summary>
        /// <param name="course">Object Course</param>
        public void UpdateCourse(TrainingWorkshop.Models.Course course)
        {
            ICourseRepository_EF rep = effactory.CourseRepository();
            rep.UpdateCourse(course);
        }

        /// <summary>
        /// Change Courses' status
        /// </summary>
        /// <param name="course">Object course</param>
        public void ChangeState(TrainingWorkshop.Models.Course course)
        {
            ICourseRepository_EF rep = effactory.CourseRepository();
            rep.ChangeState(course);
        }

    }

}
